/**
File name: elec_sw.h
Created by : Tom Sun
Date:	Dec. 4th, 2016
Description: head file of amux matrix except the sel pin connected to CAT9555(I2C to GPIO expander)
**/
#ifndef _ELEC_SW_H
#define _ELEC_SW_H

#include "stm32f4xx_hal.h"

#define		REF_1_5V_EN()		HAL_GPIO_WritePin(ADG849_CMP_SWCTL_GPIO_Port, ADG849_CMP_SWCTL_Pin, GPIO_PIN_RESET)
#define		REF_1_0V_EN()			HAL_GPIO_WritePin(ADG849_CMP_SWCTL_GPIO_Port, ADG849_CMP_SWCTL_Pin, GPIO_PIN_SET)
//#define	 	DDS_VOL_EN()			HAL_GPIO_WritePin(Switch_DC_AC_GPIO_Port, Switch_DC_AC_Pin, GPIO_PIN_SET)
#define	 	CUR_2_0V_EN()			HAL_GPIO_WritePin(ADG849_REF_SWCTL2_GPIO_Port, ADG849_REF_SWCTL2_Pin, GPIO_PIN_RESET)
#define	 	CUR_0_5V_EN()			HAL_GPIO_WritePin(ADG849_REF_SWCTL2_GPIO_Port, ADG849_REF_SWCTL2_Pin, GPIO_PIN_SET)


// External fuctions declearation
void AmuxEnableAll(void);
void AmuxDisableAll(void);
unsigned char VoltageEnable(unsigned char);
unsigned char ResistanceEnable(unsigned char channel);
unsigned char MeasuringSwitch(unsigned char channel);
void DischgSwitch(unsigned char input, unsigned char dischg);
void U3_1_Channel(unsigned char sel);
void U4_1_Channel(uint8_t sel);
void U3_3_Channel(unsigned char sel);
void U4_2_Channel(unsigned char sel);
void U5_1_Channel(unsigned char sel);
void PP4V37_EN(void);
void PP2V5_EN(void);

typedef unsigned char (*extport_channel)(unsigned char channel);

typedef struct {
    extport_channel		ExtAdc1;
    extport_channel		ExtAdc2;
} ExtAdc_interface;

extern ExtAdc_interface UserExtPort;

#endif	/*_ELEC_SW_H*/
